package aquarium.model.entity;

import oracle.adf.share.logging.ADFLogger;

import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.SequenceImpl;
import oracle.jbo.domain.Number;

public class BaseEntity extends EntityImpl {

    public static final ADFLogger LOG = ADFLogger.createADFLogger("BaseEntity");

    public BaseEntity() {
        super();
    }

    public Number getSequenceValue(String seqName) {
        Number seqNextVal;

        if (seqName != null && !seqName.equals("")) {
            SequenceImpl seq = new SequenceImpl(seqName, getDBTransaction());
            seqNextVal = seq.getSequenceNumber();
        } else {
            seqNextVal = new Number(0);
        }
        LOG.fine("getSequenceValue result " + seqNextVal + " for seqName " + seqName);
        return seqNextVal;
    }

}
